/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.softstone.sng.client;

import com.jme3.app.SimpleApplication;
import com.jme3.math.Quaternion;
import com.jme3.math.Vector3f;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Box;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Tomav
 */
public class Podstawy3D extends SimpleApplication
{

  public static void main(String[] args)
  {
    new Podstawy3D().start();
  }

  @Override
  public void simpleInitApp()
  {
    Logger.getLogger("").setLevel(Level.SEVERE);
    Geometry g = new Geometry("a", new Box(Vector3f.ZERO, 1, 1, 1));
    Quaternion q1 = new Quaternion();
    Quaternion q2 = new Quaternion();
    Vector3f walkDirection = new Vector3f(Vector3f.ZERO);
    Vector3f viewDirection = new Vector3f(Vector3f.UNIT_Z);
    Vector3f directionLeft = new Vector3f(Vector3f.UNIT_X);
    Vector3f directionUp   = new Vector3f(Vector3f.UNIT_Y);
//    q1.fromAngleAxis(.01f, directionUp);
//    q2.fromAngleAxis(.02f, directionLeft);
//    q1 = q1.mult(q2);
    g.rotate(.02f, .01f, 0);
    q1.set(g.getLocalRotation().clone());
    System.out.println(q1.toString());
    float angles[] = new float[3];
    q1.toAngles(angles);
    for(int i = 0; i < 3; i++)
      System.out.print(angles[i] + ",");
    System.out.println();
    g.setLocalRotation(g.getLocalRotation().mult(q1));
    System.out.println(g.getLocalRotation());
    Vector3f axis[] = new Vector3f[3];
    g.getLocalRotation().toAxes(axis);
    for(int i = 0; i < 3; i++)
      System.out.print(axis[i] + ",");
    System.out.println();
  }
}
